<?php

namespace app\api\logic;
use app\common\basics\Logic;
use app\service\GaodeService;
use app\service\TechnWeixinService;
use app\service\UserWeixinService;
use think\Db;


/**
 * 工作台统计
 * Class StatLogic
 * @package app\admin\logic\index
 */
class GetAddressLogic extends Logic
{
    public static function change_address($lng,$lat){
        $ni_dili_data = http_curl('https://restapi.amap.com/v3/geocode/regeo?output=json&location='.$lng.','.$lat.'&key='.GaodeService::$web_api_key);
        $ni_dili_data = json_decode($ni_dili_data, true);
        //dump($ni_dili_data);
        if($ni_dili_data['status'] != 1)
        {
            return false;
        }
        return $ni_dili_data['regeocode']['addressComponent']['citycode'];
    }

    public static function change_address_qu($lng,$lat){
        $ni_dili_data = http_curl('https://restapi.amap.com/v3/geocode/regeo?output=json&location='.$lng.','.$lat.'&key='.GaodeService::$web_api_key);
        $ni_dili_data = json_decode($ni_dili_data, true);
        //dump($ni_dili_data);
        if($ni_dili_data['status'] != 1)
        {
            return false;
        }
        return $ni_dili_data['regeocode']['addressComponent']['adcode'];
    }


}